import React from "react";

export default class ReactDemo extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            num: 100 //设置数据初始值
        };
    }

    handlePlus = (event) => {
        this.setState({num: this.state.num+1});
    }

    handleMinus = (event) => {
        this.setState({num: this.state.num-1});
    }

    render() {
        return (
            <div className="container" style={{paddingTop:30}}>
                <p>{this.state.num}</p>
                <br/>
                <button type="button" onClick={this.handlePlus}>+1</button>
                <button type="button" onClick={this.handleMinus}>-1</button>
            </div>
        );
    }
}